home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / lzsslib.zip / LZSSTEST.C < prev    next >
C/C++ Source or Header  |  1991-12-17  |  1KB  |  72 lines

  1. /*
  2.  
  3.   EDILZSS.DLL - Test program
  4.   Copyright 1991 Robert Salesas, All Rights Reserved.
  5.  
  6.   See Pascal example for more information.
  7.  
  8. */
  9.  
  10. #include <windows.h>
  11. #include <dos.h>
  12. #include <string.h>
  13.  
  14.  
  15. int FAR PASCAL LZSSPackFile(LPSTR SrcFile, LPSTR DstFile);
  16. // Packs SrcFile to DstFile using a LZSS algorithm.
  17.  
  18. int FAR PASCAL LZSSUnPackFile(LPSTR SrcFile, LPSTR DstFile);
  19. // Unpacks SrcFile to DstFile using a LZSS algorithm.
  20.  
  21.  
  22. int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance,
  23.            LPSTR lpszCmdLine, int nCmdShow )
  24.  
  25. {
  26.   int  cmdCode;
  27.   int  errCode;
  28.   char *srcFile;
  29.   char *dstFile;
  30.   char *p;
  31.   char buf[255];
  32.  
  33.   lstrcpy((LPSTR)buf, lpszCmdLine);
  34.   p = strtok(buf, " ");
  35.   if (p)
  36.     {
  37.       if (stricmp(p, "e") == 0)
  38.     cmdCode = 1;
  39.       else
  40.     cmdCode = 0;
  41.  
  42.       srcFile = strtok(NULL, " ");
  43.       if (srcFile)
  44.     {
  45.       dstFile = strtok(NULL, " ");
  46.       if (dstFile)
  47.         {
  48.           if (cmdCode == 1)
  49.         errCode = LZSSPackFile(srcFile, dstFile);
  50.           else
  51.         errCode = LZSSUnPackFile(srcFile, dstFile);
  52.  
  53.           if (errCode)
  54.         MessageBox(0, "ERROR #--, unable to complete operation.",
  55.                "EDI LZSS TEST", MB_OK | MB_ICONINFORMATION);
  56.           else
  57.         MessageBox(0, "All done.",
  58.                "EDI LZSS TEST", MB_OK | MB_ICONEXCLAMATION);
  59.  
  60.           return 0;
  61.         }
  62.     }
  63.     }
  64.  
  65.   MessageBox(0, "USAGE:  LZSSTEST e|d infile outfile", "EDI LZSS TEST",
  66.          MB_OK | MB_ICONINFORMATION);
  67. }
  68.  
  69.  
  70.  
  71.  
  72.